<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>gh-1999</title>
</head>
<body>
    <button>click me</button>
    <div></div>
    <script>
        const btn = document.querySelector('button');

        btn.addEventListener('click', function() {
            fetch('http://127.0.0.1:3000/api/data')
                .then(res => res.json())
                .then(res => {
                    document.querySelector('div').innerHTML = JSON.stringify(res.data);
                })
        })
    </script>
</body>
</html>
